﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DoubanApi;
using ZYStudios.Common;
using System.Collections.Specialized;

namespace ZYStudios.Controllers
{
    public class BaseController : Controller
    {
        static FileCacheProvider _MovieCache;
        protected DoubanApiClient CreateDoubanApi()
        {
            return new DoubanApiClient() { ApiKey=Properties.Settings.Default.ApiKey };
        }


        protected FileCacheProvider CreateFileCache()
        {
            if(_MovieCache==null)
            {
                _MovieCache=new FileCacheProvider();
                NameValueCollection aAttribs = new NameValueCollection();
                aAttribs.Add("cachePath", "/MovieCache");
                _MovieCache.Initialize("MovieCache", aAttribs);
            }
            return _MovieCache;
        }
    }
}